
#ifndef __BASE_NODE_HPP__
#define __BASE_NODE_HPP__

#include "subject.hpp"
#include <vector>
#include <string>
#include "macro.hpp"

class App;

class BaseNode {
protected:
    mb _valid=1;
    std::string _name="";
public:
    const std::string& getName() {
        return _name;
    }
    void setName( std::string const& name ) {
        _name = name;
    }
    BaseNode();
    virtual ~BaseNode();

    virtual void start() {};
    virtual void update( unsigned int deltaTime );
    virtual void destroy() {
        _valid = 0;
    }
    virtual void visit( App& app ) {
    }

    inline mb isValid() const {
       return _valid;
    }

    static mb isValid( BaseNode const* bn = nullptr ) {
        return bn && bn->_valid;
    }
};

#endif __BASE_NODE_HPP__